const storage = window.localStorage;

const save = (key: string, value: string) => {
    if (!key) {
        return;
    }
    storage.setItem(key, value || '');
};

const load = (key: string): string | null => {
    if (!key) {
        return null;
    }
    return storage.getItem(key);
}

const remove = (key: string) => {
    if (!key) {
        return;
    }
    storage.removeItem(key);
}

const clear = () => {
    return storage.clear();
}

const size = (): number => {
    return storage.length;
}

export {
    save, load, remove, clear, size
};